package com.bm.user.controller;

import com.bm.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    private IUserService iUserService;
    @PostMapping("/login")
    public void login(@RequestParam String phone,
                      @RequestParam String phoneCode,
                      @RequestParam String mail,
                      @RequestParam String mailCode){
        if(!phone.isEmpty()&&!phoneCode.isEmpty()){
            System.out.println("登录成功");
        }
        if(!mail.isEmpty()&&!mailCode.isEmpty()){
            System.out.println("登录成功");
        }
    }

    @GetMapping("/login")
    public void getCode(@RequestParam String phone,@RequestParam String mail){
        if(!phone.isEmpty()){

        }
        if(!mail.isEmpty()){
            iUserService.sendCode(mail,"1342365");
        }
    }
}
